The following diff includes config options set in this version, for your
reference. A few patches are included to add the console-auto-detection,
and the automatic turn-on of graphics and color for it. In order to get
it compiled with the VPIX_MUSIC option enabled, you need to copy the
'interp.c' from 'sys/unix/snd86unx.shr' included in the nethack source
archive to the 'src' dir.
I'm not certain, but I think the KDMKTONE feature it uses was added in
a later 1.3 kernel, so you might need a current 1.3 kernel if you want to
have sound.
You might also need to chose another compiler version in the Makefiles,
since it is not likely that you system has the pentium-gcc 2.7.2p installed.

Enjoy

Andreas Arens

diff -ur nethack-3.1.3/include/config.h nethack-3.1.3-linux/include/config.h
--- nethack-3.1.3/include/config.h	Tue Jul 20 18:28:26 1993
+++ nethack-3.1.3-linux/include/config.h	Mon Mar 25 13:38:48 1996
@@ -261,12 +261,12 @@
 
 #ifdef UNIX
 /* path and file name extension for compression program */
-# define COMPRESS "/usr/ucb/compress"	     /* Lempel-Ziv compression */
-# define COMPRESS_EXTENSION ".Z"	     /* compress's extension */
+/* # define COMPRESS "/usr/ucb/compress"	     /* Lempel-Ziv compression */
+/* # define COMPRESS_EXTENSION ".Z"	     /* compress's extension */
 
 /* An example of one alternative you might want to use: */
-/* # define COMPRESS "/usr/local/bin/gzip"   /* FSF gzip compression */
-/* # define COMPRESS_EXTENSION ".gz"	     /* normal gzip extension */
+# define COMPRESS "/bin/gzip"   /* FSF gzip compression */
+# define COMPRESS_EXTENSION ".gz"	     /* normal gzip extension */
 #endif
 #ifndef COMPRESS
 # define INTERNAL_COMP	/* control use of NetHack's compression routines */
@@ -297,7 +297,7 @@
  * since the user might create files in a directory of his choice.
  * Of course SECURE is meaningful only if HACKDIR is defined.
  */
-/* #define SECURE	/* do setuid(getuid()) after chdir() */
+#define SECURE	/* do setuid(getuid()) after chdir() */
 
 /*
  * If it is desirable to limit the number of people that can play Hack
@@ -388,9 +388,9 @@
  * functions that have been macroized.
  */
 
-/*#define VISION_TABLES	/* use vision tables generated at compile time */
+#define VISION_TABLES	/* use vision tables generated at compile time */
 #ifdef VISION_TABLES
-# define BRACES		/* put braces around rows of 2d arrays */
+# define noBRACES		/* put braces around rows of 2d arrays */
 #else
 # define MACRO_CPATH	/* use clear_path macros instead of functions */
 #endif
diff -ur nethack-3.1.3/include/unixconf.h nethack-3.1.3-linux/include/unixconf.h
--- nethack-3.1.3/include/unixconf.h	Tue Jul 20 18:24:16 1993
+++ nethack-3.1.3-linux/include/unixconf.h	Mon Mar 25 13:00:16 1996
@@ -19,7 +19,7 @@
  */
 
 /* define exactly one of the following four choices */
-#define BSD		/* define for 4.n BSD  */
+/* #define BSD		/* define for 4.n BSD  */
 			/* also for relatives like SunOS, Linux and DG/UX */
 /* #define ULTRIX	/* define for Ultrix v3.0 or higher (but not lower) */
 			/* Use BSD for < v3.0 */
@@ -34,18 +34,18 @@
 #define NETWORK	/* if running on a networked system */
 			/* e.g. Suns sharing a playground through NFS */
 #define SUNOS4	/* SunOS 4.x */
-/* #define LINUX  /* Another Unix clone running on Intel processors */
+#define LINUX  /* Another Unix clone running on Intel processors */
 /* #define GENIX	/* Yet Another Unix Clone */
 /* #define HISX		/* Bull Unix for XPS Machines */
 /* #define BOS		/* Bull Open Software - Unix for DPX/2 Machines */
 /* #define UNIXPC	/* use in addition to SYSV for AT&T 7300/3B1 */
 /* #define AIX_31	/* In AIX 3.1 (IBM RS/6000) use BSD ioctl's to gain
 			   job control (note that AIX is SYSV otherwise) */
-/* #define TEXTCOLOR	/* Use System V r3.2 terminfo color support */
+#define TEXTCOLOR	/* Use System V r3.2 terminfo color support */
 			/* or ANSI color support on termcap systems */
 			/* or X11 color	*/
-/* #define POSIX_JOB_CONTROL	/* use System V POSIX job control */
-/* #define POSIX_TYPES	/* use POSIX types for system calls and termios */
+#define POSIX_JOB_CONTROL	/* use System V POSIX job control */
+#define POSIX_TYPES	/* use POSIX types for system calls and termios */
                         /* define for platforms using the GNU libraries */
                         /* linux, etc .. */
 
@@ -65,7 +65,7 @@
 /* see sys/unix/snd86.shr for more information on these */
 /* #define UNIX386MUSIC	/* Play real music through speaker on systems with
 			   music driver installed */
-/* #define VPIX_MUSIC	/* Play real music through speaker on systems with
+#define VPIX_MUSIC	/* Play real music through speaker on systems with
 			   built-in VPIX support */
 
 
@@ -97,7 +97,7 @@
  * Normally, you shouldn't need to change this.
  * There is currently no port-specific help for Unix systems.
  */
-/* #define PORT_HELP "Unixhelp" */
+#define PORT_HELP "Unixhelp"
 
 /*
  * If you define MAIL, then the player will be notified of new mail
diff -ur nethack-3.1.3/src/music.c nethack-3.1.3-linux/src/music.c
--- nethack-3.1.3/src/music.c	Tue Jul 20 18:27:57 1993
+++ nethack-3.1.3-linux/src/music.c	Mon Mar 25 14:18:04 1996
@@ -623,7 +623,10 @@
 
 #ifdef VPIX_MUSIC
 
-# if 0
+#ifdef __linux__
+#include <sys/kd.h>
+#else
+# if 0	/* SYSV-based IBCS2 system */
 #include <sys/types.h>
 #include <sys/console.h>
 #include <sys/vtkd.h>
@@ -631,9 +634,14 @@
 #define KIOC ('K' << 8)
 #define KDMKTONE (KIOC | 8)
 # endif
+#endif
 
 #define noDEBUG
 
+static void tone();
+static void rest();
+static void speaker();
+
 #include "interp.c"	/* from snd86unx.shr */
 
 static void tone(hz, ticks)
@@ -644,7 +652,11 @@
 # ifdef DEBUG
     printf("TONE: %6d %6d\n",hz,ticks * 10);
 # endif
+#ifdef __linux__
+    usleep(ticks * 10000);
+#else
     nap(ticks * 10);
+#endif
 }
 
 
@@ -652,7 +664,11 @@
 /* rest for given number of ticks */
 int	ticks;
 {
+#ifdef __linux__
+    usleep(ticks * 10000);
+#else
     nap(ticks * 10);
+#endif
 # ifdef DEBUG
     printf("REST:        %6d\n",ticks * 10);
 # endif
diff -ur nethack-3.1.3/sys/unix/Makefile.src nethack-3.1.3-linux/sys/unix/Makefile.src
--- nethack-3.1.3/sys/unix/Makefile.src	Tue Jul 20 18:28:29 1993
+++ nethack-3.1.3-linux/sys/unix/Makefile.src	Mon Mar 25 13:09:24 1996
@@ -91,8 +91,12 @@
 # flags for debugging:
 # CFLAGS = -g -I../include
 
-CFLAGS = -g -I../include
-LFLAGS =
+# CFLAGS = -g -I../include
+# LFLAGS =
+
+CC = gcc -V 2.7.2p
+CFLAGS = -O3 -I../include
+LFLAGS = -s
 
 
 # Set the WINSRC, WINOBJ, and WINLIB lines to correspond to your desired
@@ -127,7 +131,8 @@
 # WINTTYLIB = -ltermcap
 # WINTTYLIB = -lcurses
 # WINTTYLIB = -lcurses16
-WINTTYLIB = -ltermlib
+# WINTTYLIB = -ltermlib
+WINTTYLIB = -lncurses
 #
 # libraries for X11
 WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11
diff -ur nethack-3.1.3/sys/unix/ioctl.c nethack-3.1.3-linux/sys/unix/ioctl.c
--- nethack-3.1.3/sys/unix/ioctl.c	Tue May 11 08:51:14 1993
+++ nethack-3.1.3-linux/sys/unix/ioctl.c	Mon Mar 25 14:55:02 1996
@@ -66,6 +66,10 @@
 extern void NDECL(sco_mapon);
 extern void NDECL(sco_mapoff);
 #endif
+#ifdef __linux__
+extern void NDECL(linux_mapon);
+extern void NDECL(linux_mapoff);
+#endif
 
 #ifdef AUX
 void *
@@ -152,6 +156,9 @@
 #  ifdef _M_UNIX
 		sco_mapon();
 #  endif
+#  ifdef __linux__
+		linux_mapon();
+#  endif
 		(void) signal(SIGTSTP, SIG_DFL);
 #  ifdef AUX
 		( void ) kill ( 0 , SIGSTOP ) ;
@@ -160,6 +167,9 @@
 #  endif
 #  ifdef _M_UNIX
 		sco_mapoff();
+#  endif
+#  ifdef __linux__
+		linux_mapoff();
 #  endif
 		resume_nhwindows();
 	} else {
diff -ur nethack-3.1.3/sys/unix/setup.sh nethack-3.1.3-linux/sys/unix/setup.sh
--- nethack-3.1.3/sys/unix/setup.sh	Mon Jan 25 18:52:25 1993
+++ nethack-3.1.3-linux/sys/unix/setup.sh	Mon Mar 25 13:04:36 1996
@@ -7,7 +7,7 @@
 # know there's a non-default behavior are assumed to pay enough attention
 # to keep distribution versions if they modify things.
 
-if [ $# -gt 0 ] ; then
+if [ 1 ] ; then
 #	First, try to make a symbolic link.
 #
 	ln -s Makefile.top Makefile >/dev/null 2>&1
diff -ur nethack-3.1.3/sys/unix/unixmain.c nethack-3.1.3-linux/sys/unix/unixmain.c
--- nethack-3.1.3/sys/unix/unixmain.c	Sun Apr 25 19:16:54 1993
+++ nethack-3.1.3-linux/sys/unix/unixmain.c	Mon Mar 25 12:56:59 1996
@@ -30,6 +30,10 @@
 extern void NDECL(check_sco_console);
 extern void NDECL(init_sco_cons);
 #endif
+#ifdef __linux__
+extern void NDECL(check_linux_console);
+extern void NDECL(init_linux_cons);
+#endif
 
 int
 main(argc,argv)
@@ -95,11 +99,17 @@
 #ifdef _M_UNIX
 	check_sco_console();
 #endif
+#ifdef __linux__
+	check_linux_console();
+#endif
 	initoptions();
 	init_nhwindows();
 	exact_username = whoami();
 #ifdef _M_UNIX
 	init_sco_cons();
+#endif
+#ifdef __linux__
+	init_linux_console();
 #endif
 
 	/*
diff -ur nethack-3.1.3/sys/unix/unixtty.c nethack-3.1.3-linux/sys/unix/unixtty.c
--- nethack-3.1.3/sys/unix/unixtty.c	Sun Apr 25 19:16:55 1993
+++ nethack-3.1.3-linux/sys/unix/unixtty.c	Mon Mar 25 15:02:11 1996
@@ -365,6 +365,58 @@
 #endif	/* _M_UNIX */
 
 
+
+#ifdef __linux__
+#include <sys/vt.h>
+int sco_flag_console = 0;	/* Fake, to ease porting */
+
+void
+linux_mapon()
+{
+# ifdef TTY_GRAPHICS
+	if (!strcmp(windowprocs.name, "tty") && sco_flag_console) {
+		write(1,"\033(B",3);
+	}
+# endif
+}
+
+void
+linux_mapoff()
+{
+# ifdef TTY_GRAPHICS
+	if (!strcmp(windowprocs.name, "tty") && sco_flag_console) {
+		write(1,"\033(U",3);
+	}
+# endif
+}
+
+void
+check_linux_console()
+{
+        struct vt_mode vtm;
+
+	if (isatty(0) && ioctl(0,VT_GETMODE,&vtm) >= 0) {
+		sco_flag_console = 1; 
+	}
+}
+
+void
+init_linux_console()
+{
+# ifdef TTY_GRAPHICS
+	if (!strcmp(windowprocs.name, "tty") && sco_flag_console) {
+		atexit(linux_mapon);
+		linux_mapoff();
+		switch_graphics(IBM_GRAPHICS);
+		if (has_colors())
+			flags.use_color = TRUE;
+	}
+# endif
+}
+#endif	/* __linux__ */
+
+
+
 /* fatal error */
 /*VARARGS1*/
 
diff -ur nethack-3.1.3/sys/unix/unixunix.c nethack-3.1.3-linux/sys/unix/unixunix.c
--- nethack-3.1.3/sys/unix/unixunix.c	Tue Jul 20 18:28:30 1993
+++ nethack-3.1.3-linux/sys/unix/unixunix.c	Mon Mar 25 14:59:37 1996
@@ -20,6 +20,10 @@
 extern void NDECL(sco_mapon);
 extern void NDECL(sco_mapoff);
 #endif
+#ifdef __linux__
+extern void NDECL(linux_mapon);
+extern void NDECL(linux_mapoff);
+#endif
 
 static struct stat buf, hbuf;
 
@@ -313,6 +317,9 @@
 #ifdef _M_UNIX
 	sco_mapon();
 #endif
+#ifdef __linux__
+	linux_mapon();
+#endif
 	if((f = fork()) == 0){		/* child */
 		(void) setgid(getgid());
 		(void) setuid(getuid());
@@ -331,6 +338,9 @@
 	(void) wait( (int *) 0);
 #ifdef _M_UNIX
 	sco_mapoff();
+#endif
+#ifdef __linux__
+	linux_mapoff();
 #endif
 	(void) signal(SIGINT, (SIG_RET_TYPE) done1);
 #ifdef WIZARD
